package com.example.rentingapp.adapter;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;

import com.example.rentingapp.R;

public class ChildrenCategoryAdapter extends BaseAdapter {
    private LayoutInflater mInflater;   //布局加载器
    private Context mContext;           //上下文
    private String[] mData;             //筛选条件数据

    public ChildrenCategoryAdapter(Context context) {
        mInflater = LayoutInflater.from(context);
        mContext = context;
    }

    public void setDatas(String[] Data) {
        this.mData = Data;
    }

    @Override
    public int getCount() {
        if (mData == null) {
            return 0;
        }
        return mData.length;
    }

    @Override
    public Object getItem(int position) {
        return null;
    }

    @Override
    public long getItemId(int position) {
        return 0;
    }

    @Override
    public View getView(int position, View convertView, ViewGroup viewGroup) {
        ViewHolder holder = null;
        if (convertView == null) {
            convertView = mInflater.inflate(R.layout.double_popup_list_item, null);
            holder = new ViewHolder();
            holder.mTitleTv = (TextView) convertView.findViewById(R.id.tv_double_pop_title);
            convertView.setTag(holder);
        } else {
            holder = (ViewHolder) convertView.getTag();
        }
        holder.mTitleTv.setText(mData[position]);
        return convertView;
    }

    public class ViewHolder {
        //筛选项文字tv
        TextView mTitleTv;
    }
}
